class Device
Defined at line 40 of file ../../src/media/audio/services/device_registry/device.h
This class represents a driver and audio device, once it is detected.
Public Methods
bool has_error ()
Simple accessors
This is the const subset available to device observers.
Defined at line 147 of file ../../src/media/audio/services/device_registry/device.h
bool is_operational ()
Defined at line 148 of file ../../src/media/audio/services/device_registry/device.h
fuchsia_audio_device::DeviceType device_type ()
Defined at line 149 of file ../../src/media/audio/services/device_registry/device.h
bool is_codec ()
Defined at line 150 of file ../../src/media/audio/services/device_registry/device.h
bool is_composite ()
Defined at line 151 of file ../../src/media/audio/services/device_registry/device.h
TokenId token_id ()
Assigned by this service, guaranteed unique for this boot session, but not across reboots.
Defined at line 156 of file ../../src/media/audio/services/device_registry/device.h
const std::optional<fuchsia_audio_device::Info> & info ()
`info` is only populated once the device is initialized.
Defined at line 158 of file ../../src/media/audio/services/device_registry/device.h
const std::vector<fuchsia_audio_device::ElementDaiFormatSet> & dai_format_sets ()
Defined at line 161 of file ../../src/media/audio/services/device_registry/device.h
const std::vector<fuchsia_audio_device::ElementRingBufferFormatSet> & ring_buffer_format_sets ()
Defined at line 164 of file ../../src/media/audio/services/device_registry/device.h
fuchsia_audio::Format ring_buffer_format (ElementId element_id)
TODO(https://fxbug.dev/42069015): Consider using media_audio::Format internally.
Defined at line 170 of file ../../src/media/audio/services/device_registry/device.h
std::optional<int16_t> valid_bits_per_sample (ElementId element_id)
Defined at line 177 of file ../../src/media/audio/services/device_registry/device.h
std::optional<bool> supports_set_active_channels (ElementId element_id)
Defined at line 185 of file ../../src/media/audio/services/device_registry/device.h
bool dai_format_is_set ()
Defined at line 191 of file ../../src/media/audio/services/device_registry/device.h
const fuchsia_hardware_audio::CodecFormatInfo & codec_format_info (ElementId element_id)
Defined at line 192 of file ../../src/media/audio/services/device_registry/device.h
bool codec_is_started ()
Defined at line 195 of file ../../src/media/audio/services/device_registry/device.h
bool has_codec_properties ()
Defined at line 197 of file ../../src/media/audio/services/device_registry/device.h
bool has_composite_properties ()
Defined at line 198 of file ../../src/media/audio/services/device_registry/device.h
bool has_health_state ()
Defined at line 199 of file ../../src/media/audio/services/device_registry/device.h
bool dai_format_sets_retrieved ()
Defined at line 200 of file ../../src/media/audio/services/device_registry/device.h
bool ring_buffer_format_sets_retrieved ()
Defined at line 201 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & dai_ids ()
Defined at line 202 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & ring_buffer_ids ()
Defined at line 203 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<TopologyId> & topology_ids ()
Defined at line 204 of file ../../src/media/audio/services/device_registry/device.h
const std::unordered_set<ElementId> & element_ids ()
Defined at line 205 of file ../../src/media/audio/services/device_registry/device.h
bool has_plug_state ()
Defined at line 207 of file ../../src/media/audio/services/device_registry/device.h
bool checked_for_signalprocessing ()
Defined at line 208 of file ../../src/media/audio/services/device_registry/device.h
bool supports_signalprocessing ()
Defined at line 209 of file ../../src/media/audio/services/device_registry/device.h
std::shared_ptr<DeviceInspectInstance> inspect ()
Defined at line 212 of file ../../src/media/audio/services/device_registry/device.h
uint64_t count ()
Static object counts, for debugging purposes.
Defined at line 215 of file ../../src/media/audio/services/device_registry/device.h
uint64_t initialized_count ()
Defined at line 216 of file ../../src/media/audio/services/device_registry/device.h
uint64_t unhealthy_count ()
Defined at line 217 of file ../../src/media/audio/services/device_registry/device.h
std::shared_ptr<Device> Create (std::weak_ptr<DevicePresenceWatcher> presence_watcher, async_dispatcher_t * dispatcher, std::string_view name, fuchsia_audio_device::DeviceType device_type, fuchsia_audio_device::DriverClient driver_client, const std::string & added_by)
static
Defined at line 265 of file ../../src/media/audio/services/device_registry/device.cc
void ~Device ()
Defined at line 328 of file ../../src/media/audio/services/device_registry/device.cc
void Initialize ()
Defined at line 719 of file ../../src/media/audio/services/device_registry/device.cc
bool AddObserver (const std::shared_ptr<ObserverNotify> & observer_to_add)
Defined at line 558 of file ../../src/media/audio/services/device_registry/device.cc
bool SetControl (std::shared_ptr<ControlNotify> control_notify)
Returns true if the specified entity successfully asserts control of this device.
Defined at line 496 of file ../../src/media/audio/services/device_registry/device.cc
void DropRingBuffer (ElementId element_id)
Whether client- or device-originated, reset any state associated with an active RingBuffer.
Defined at line 622 of file ../../src/media/audio/services/device_registry/device.cc
std::optional<fuchsia_hardware_audio::Format2> SupportedDriverFormatForClientFormat (ElementId element_id, const fuchsia_audio::Format & client_format)
Determine the full fuchsia_hardware_audio::Format needed for ConnectRingBufferFidl.
This method expects that the required fields are present.
Defined at line 1733 of file ../../src/media/audio/services/device_registry/device.cc
void SetDaiFormat (ElementId element_id, const fuchsia_hardware_audio::DaiFormat & dai_formats)
This method guarantees that ControlNotify's DaiFormatIsChanged or DaiFormatIsNotChanged will
eventually be called, either immediately or asynchronously when driver SetDaiFormat concludes.
Defined at line 1855 of file ../../src/media/audio/services/device_registry/device.cc
bool Reset ()
If true is returned, then we guarantee to call ControlNotify::DeviceIsReset (and CodecIsStopped
if the Start/Stop state is changed, and DaiFormatIsChanged if the DaiFormat is changed).
If false is returned, then no change occurs and these notifications will not be called.
Defined at line 2032 of file ../../src/media/audio/services/device_registry/device.cc
bool CodecStart ()
If true is returned, then we guarantee to call CodecIsStarted/CodecIsNotStarted on ControlNotify.
If false is returned, then this notification will not be called.
Defined at line 2134 of file ../../src/media/audio/services/device_registry/device.cc
bool CodecStop ()
If true is returned, then we guarantee to call CodecIsStopped or CodecIsNotStopped on
ControlNotify. If false is returned, then this notification will not be called.
Defined at line 2189 of file ../../src/media/audio/services/device_registry/device.cc
zx_status_t SetTopology (TopologyId topology_id)
If the method does not return ZX_OK, then the driver was not called.
Defined at line 1357 of file ../../src/media/audio/services/device_registry/device.cc
zx_status_t SetElementState (ElementId element_id, const fuchsia_hardware_audio_signalprocessing::SettableElementState & element_state)
If the method does not return ZX_OK, then the driver was not called.
Defined at line 1253 of file ../../src/media/audio/services/device_registry/device.cc
bool CreateRingBuffer (ElementId element_id, const fuchsia_hardware_audio::Format2 & format, uint32_t requested_ring_buffer_bytes, fit::callback<void (fit::result<fuchsia_audio_device::ControlCreateRingBufferError, Device::RingBufferInfo>)> create_ring_buffer_callback)
This method guarantees to call create_ring_buffer_callback (immediately or asynchronously).
For certain unrecoverable errors, OnError is called as well.
Defined at line 2244 of file ../../src/media/audio/services/device_registry/device.cc
bool SetActiveChannels (ElementId element_id, uint64_t channel_bitmask, fit::callback<void (zx::result<zx::time>)> set_active_channels_callback)
Change the channels that are currently active (powered-up).
Defined at line 2644 of file ../../src/media/audio/services/device_registry/device.cc
void StartRingBuffer (ElementId element_id, fit::callback<void (zx::result<zx::time>)> start_callback)
Start the device ring buffer now (including clock recovery).
Defined at line 2739 of file ../../src/media/audio/services/device_registry/device.cc
void StopRingBuffer (ElementId element_id, fit::callback<void (zx_status_t)> stop_callback)
Stop the device ring buffer now (including device clock recovery).
Defined at line 2793 of file ../../src/media/audio/services/device_registry/device.cc
zx::result<zx::clock> GetReadOnlyClock ()
Create a duplicate handle to our clock with limited rights. We can transfer it to a client who
can only read and duplicate. Specifically, they cannot change this clock's rate or offset.
Defined at line 1715 of file ../../src/media/audio/services/device_registry/device.cc
void SetSignalProcessingSupported (bool is_supported)
Called during initialization, when we know definitively whether the driver supports the protocol.
It might also be called later, if there is an error related to the signalprocessing protocol.
If this is the first time this is called, then call `OnInitializationResponse` to unblock the
signalprocessing-related aspect of the "wait for multiple responses" state machine.
Defined at line 338 of file ../../src/media/audio/services/device_registry/device.cc
Records
Friends
std::ostream & Device (std::ostream & out, RingBufferState ring_buffer_state)
std::ostream & Device (std::ostream & out, State device_state)
class AudioDeviceRegistryServerTestBase
class CompositeTest
class CodecTest
class DeviceTest
class DeviceTestBase