pub struct Emulator { /* private fields */ }
Expand description
Represents a bt-hci device emulator. Instances of this type can be used manage the
bt-hci-emulator driver within the test device hierarchy. The associated driver instance gets
unbound and all bt-hci and bt-emulator device instances destroyed when
destroy_and_wait()
resolves successfully.
destroy_and_wait()
MUST be called for proper clean up of the emulator device.
Implementations§
Source§impl Emulator
impl Emulator
Sourcepub fn default_settings() -> EmulatorSettings
pub fn default_settings() -> EmulatorSettings
Returns the default settings.
Sourcepub async fn create(dev_directory: DirectoryProxy) -> Result<Emulator, Error>
pub async fn create(dev_directory: DirectoryProxy) -> Result<Emulator, Error>
Publish a new bt-emulator device and return a handle to it. No corresponding bt-hci device
will be published; to do so it must be explicitly configured and created with a call to
publish()
. If realm
is present, the device will be created inside it, otherwise it will
be created using the /dev
directory in the component’s namespace.
Sourcepub async fn create_and_publish(
dev_directory: DirectoryProxy,
) -> Result<Emulator, Error>
pub async fn create_and_publish( dev_directory: DirectoryProxy, ) -> Result<Emulator, Error>
Publish a bt-emulator and a bt-hci device using the default emulator settings. If realm
is present, the device will be created inside it, otherwise it will be created using the
/dev
directory in the component’s namespace.
Sourcepub async fn publish(&self, settings: EmulatorSettings) -> Result<(), Error>
pub async fn publish(&self, settings: EmulatorSettings) -> Result<(), Error>
Sends a publish message to the emulator. This is a convenience method that internally handles the FIDL binding error.
pub async fn publish_and_wait_for_device_path( &self, settings: EmulatorSettings, ) -> Result<String, Error>
Sourcepub async fn destroy_and_wait(&mut self) -> Result<(), Error>
pub async fn destroy_and_wait(&mut self) -> Result<(), Error>
Sends the test device a destroy message which will unbind the driver. This will wait for the test device to be unpublished from devfs.