diff --git a/bumble/profiles/bap.py b/bumble/profiles/bap.py index bc06dae0b..d06dac547 100644 --- a/bumble/profiles/bap.py +++ b/bumble/profiles/bap.py @@ -33,6 +33,11 @@ from bumble import gatt_client +# ----------------------------------------------------------------------------- +# Logging +# ----------------------------------------------------------------------------- +logger = logging.getLogger(__name__) + # ----------------------------------------------------------------------------- # Constants # ----------------------------------------------------------------------------- @@ -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, @@ -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()) @@ -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(