From dc1204531e22d14aca955753497c1a3e503f1712 Mon Sep 17 00:00:00 2001 From: Josh Wu Date: Wed, 3 Apr 2024 17:58:04 +0800 Subject: [PATCH] Correct HFP AG indicator index --- bumble/hfp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bumble/hfp.py b/bumble/hfp.py index 5adfcb9..145523d 100644 --- a/bumble/hfp.py +++ b/bumble/hfp.py @@ -820,11 +820,11 @@ class HfProtocol(pyee.EventEmitter): return calls async def update_ag_indicator(self, index: int, value: int): - self.ag_indicators[index].current_status = value - self.emit('ag_indicator', self.ag_indicators[index]) - logger.info( - f"AG indicator updated: {self.ag_indicators[index].description}, {value}" - ) + # CIEV is in 1-index, while ag_indicators is in 0-index. + ag_indicator = self.ag_indicators[index - 1] + ag_indicator.current_status = value + self.emit('ag_indicator', ag_indicator) + logger.info(f"AG indicator updated: {ag_indicator.description}, {value}") async def handle_unsolicited(self): """Handle unsolicited result codes sent by the audio gateway."""