pub fn update_indicator_value(
        &mut self,
        indicator: at::BluetoothHFIndicator,
        value: i64,
    ) -> Result<HfIndicator, ()> {
        let ind = match indicator {
            at::BluetoothHFIndicator::EnhancedSafety if self.enhanced_safety.enabled => {
                if value != 0 && value != 1 {
                    return Err(());
                }
                let v = value != 0;
                self.enhanced_safety.value = Some(v);
                HfIndicator::EnhancedSafety(v)
            }
            at::BluetoothHFIndicator::BatteryLevel if self.battery_level.enabled => {
                if value < 0 || value > Self::MAX_BATTERY_LEVEL.into() {
                    return Err(());
                }
                let v = value as u8;
                self.battery_level.value = Some(v);
                HfIndicator::BatteryLevel(v)
            }
            ind => {
                log::warn!("Received HF indicator update for disabled indicator: {:?}", ind);
                return Err(());
            }
        };
        Ok(ind)
    }
/// Updates the `indicator` with the provided `value`.
/// Returns Error if the indicator is disabled or if the `value` is out of bounds.
/// Returns a valid HfIndicator on success.
Updates the `indicator` with the provided `value`.
Returns Error if the indicator is disabled or if the `value` is out of bounds.
Returns a valid HfIndicator on success.
Updates the ` indicator ` with the provided ` value ` . Returns Error if the indicator is disabled or if the ` value ` is out of bounds . Returns a valid HfIndicator on success .
pub fn update_indicator_value(
        &mut self,
        indicator: at::BluetoothHFIndicator,
        value: i64,
    ) -> Result<HfIndicator, ()> {
        let ind = match indicator {
            at::BluetoothHFIndicator::EnhancedSafety if self.enhanced_safety.enabled => {
                if value != 0 && value != 1 {
                    return Err(());
                }
                let v = value != 0;
                self.enhanced_safety.value = Some(v);
                HfIndicator::EnhancedSafety(v)
            }
            at::BluetoothHFIndicator::BatteryLevel if self.battery_level.enabled => {
                if value < 0 || value > Self::MAX_BATTERY_LEVEL.into() {
                    return Err(());
                }
                let v = value as u8;
                self.battery_level.value = Some(v);
                HfIndicator::BatteryLevel(v)
            }
            ind => {
                log::warn!("Received HF indicator update for disabled indicator: {:?}", ind);
                return Err(());
            }
        };
        Ok(ind)
    }
pub fn update_indicator_value ( & mut self , indicator : at :: BluetoothHFIndicator , value : i64 , ) -> Result < HfIndicator , ( ) > { let ind = match indicator { at :: BluetoothHFIndicator :: EnhancedSafety if self . enhanced_safety . enabled => { if value != 0 && value != 1 { return Err ( ( ) ) ; } let v = value != 0 ; self . enhanced_safety . value = Some ( v ) ; HfIndicator :: EnhancedSafety ( v ) } at :: BluetoothHFIndicator :: BatteryLevel if self . battery_level . enabled => { if value < 0 || value > Self :: MAX_BATTERY_LEVEL . into ( ) { return Err ( ( ) ) ; } let v = value as u8 ; self . battery_level . value = Some ( v ) ; HfIndicator :: BatteryLevel ( v ) } ind => { log :: warn ! ( " " ind ) ; return Err ( ( ) ) ; } } ; Ok ( ind ) }
Updates the `indicator` with the provided `value`.
Updates the ` indicator ` with the provided ` value ` .
&mut self
indicator
at::BluetoothHFIndicator
value
i64
&mut self
indicator
at::BluetoothHFIndicator
value
i64