pub async fn send_get_notification(
        &self,
        event: NotificationEvent,
    ) -> Result<Notification, TargetAvcError> {
        if event == NotificationEvent::VolumeChanged {
            let send_command_fut = {
                let inner_guard = self.inner.lock();
                match &inner_guard.absolute_volume_handler {
                    Some(absolute_volume_handler) => absolute_volume_handler.get_current_volume(),
                    // we have don't have a target handler, return no players available
                    None => return Err(TargetAvcError::RejectedNoAvailablePlayers),
                }
            };

            // if we have a FIDL error return no players
            let volume =
                send_command_fut.await.map_err(|_| TargetAvcError::RejectedNoAvailablePlayers)?;

            let mut notif = Notification::new_empty();
            notif.volume = Some(volume);
            Ok(notif)
        } else {
            let send_command_fut = {
                let inner_guard = self.inner.lock();
                match &inner_guard.target_handler {
                    Some(target_handler) => target_handler.get_notification(event),
                    // we have don't have a target handler, return no players available
                    None => return Err(TargetAvcError::RejectedNoAvailablePlayers),
                }
            };

            // if we have a FIDL error, return no players available
            send_command_fut.await.map_err(|_| TargetAvcError::RejectedNoAvailablePlayers)?
        }
    }
/// Get current value of the notification
Get current value of the notification
Get current value of the notification
pub async fn send_get_notification(
        &self,
        event: NotificationEvent,
    ) -> Result<Notification, TargetAvcError> {
        if event == NotificationEvent::VolumeChanged {
            let send_command_fut = {
                let inner_guard = self.inner.lock();
                match &inner_guard.absolute_volume_handler {
                    Some(absolute_volume_handler) => absolute_volume_handler.get_current_volume(),
                    // we have don't have a target handler, return no players available
                    None => return Err(TargetAvcError::RejectedNoAvailablePlayers),
                }
            };
            // if we have a FIDL error return no players
            let volume =
                send_command_fut.await.map_err(|_| TargetAvcError::RejectedNoAvailablePlayers)?;
            let mut notif = Notification::new_empty();
            notif.volume = Some(volume);
            Ok(notif)
        } else {
            let send_command_fut = {
                let inner_guard = self.inner.lock();
                match &inner_guard.target_handler {
                    Some(target_handler) => target_handler.get_notification(event),
                    // we have don't have a target handler, return no players available
                    None => return Err(TargetAvcError::RejectedNoAvailablePlayers),
                }
            };
            // if we have a FIDL error, return no players available
            send_command_fut.await.map_err(|_| TargetAvcError::RejectedNoAvailablePlayers)?
        }
    }
pub async fn send_get_notification ( & self , event : NotificationEvent , ) -> Result < Notification , TargetAvcError > { if event == NotificationEvent :: VolumeChanged { let send_command_fut = { let inner_guard = self . inner . lock ( ) ; match & inner_guard . absolute_volume_handler { Some ( absolute_volume_handler ) => absolute_volume_handler . get_current_volume ( ) , // we have don't have a target handler, return no players available None => return Err ( TargetAvcError :: RejectedNoAvailablePlayers ) , } } ; // if we have a FIDL error return no players let volume = send_command_fut . await . map_err ( | _ | TargetAvcError :: RejectedNoAvailablePlayers ) ? ; let mut notif = Notification :: new_empty ( ) ; notif . volume = Some ( volume ) ; Ok ( notif ) } else { let send_command_fut = { let inner_guard = self . inner . lock ( ) ; match & inner_guard . target_handler { Some ( target_handler ) => target_handler . get_notification ( event ) , // we have don't have a target handler, return no players available None => return Err ( TargetAvcError :: RejectedNoAvailablePlayers ) , } } ; // if we have a FIDL error, return no players available send_command_fut . await . map_err ( | _ | TargetAvcError :: RejectedNoAvailablePlayers ) ? } }
Get current value of the notification
Get current value of the notification
&self
event
NotificationEvent
&self
event
NotificationEvent