Skip to content

Commit

Permalink
Fix ASE state change
Browse files Browse the repository at this point in the history
  • Loading branch information
zxzxwu committed Dec 7, 2023
1 parent 21c38f5 commit ffbaa7e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions bumble/profiles/bap.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
from bumble import gatt_client


# -----------------------------------------------------------------------------
# Logging
# -----------------------------------------------------------------------------
logger = logging.getLogger(__name__)

# -----------------------------------------------------------------------------
# Constants
# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -976,7 +981,7 @@ def on_update_metadata(
return (AseResponseCode.SUCCESS, AseReasonCode.NONE)

def on_release(self) -> Tuple[AseResponseCode, AseReasonCode]:
if self.state != AseStateMachine.State.IDLE:
if self.state == AseStateMachine.State.IDLE:
return (
AseResponseCode.INVALID_ASE_STATE_MACHINE_TRANSITION,
AseReasonCode.NONE,
Expand All @@ -990,7 +995,7 @@ async def remove_cis_async():
data_path_direction=self.role,
)
)
self.state = self.State.CODEC_CONFIGURED
self.state = self.State.IDLE
await self.service.device.notify_subscribers(self, self.value)

self.service.device.abort_on('flush', remove_cis_async())
Expand Down Expand Up @@ -1101,7 +1106,7 @@ def on_operation(self, opcode: ASE_Operation.Opcode, ase_id: int, args):
def on_write_ase_control_point(self, connection, data):
operation = ASE_Operation.from_bytes(data)
responses = []
logging.debug(f'*** ASCS Write {operation} ***')
logger.debug(f'*** ASCS Write {operation} ***')

if operation.op_code == ASE_Operation.Opcode.CONFIG_CODEC:
for ase_id, *args in zip(
Expand Down

0 comments on commit ffbaa7e

Please sign in to comment.