class DeviceWatcher
Defined at line 25 of file ../../src/lib/fsl/io/device_watcher.h
Watches for devices to be registered in devfs.
TODO(jeffbrown): Generalize to watching arbitrary directories or dealing
with removal when fdio has a protocol for it.
Public Methods
void ~DeviceWatcher ()
Defined at line 37 of file ../../src/lib/fsl/io/device_watcher.h
std::unique_ptr<DeviceWatcher> Create (const std::string & directory_path, ExistsCallback exists_callback, async_dispatcher_t * dispatcher)
Creates a device watcher associated with the current message loop.
Asynchronously invokes |exists_callback| for all existing devices within
the specified directory as well as any subsequently added devices until
the device watcher is destroyed. Ignores the "." directory.
Equivalent to:
CreateWithIdleCallback(directory_path, exists_callback, []{});
|directory_path| is the directory to watch (without a trailing slash).
|exists_callback| gets called with each existing or new filename, or with
an empty string after existing files if empty_after_existing is true.
Defined at line 63 of file ../../src/lib/fsl/io/device_watcher.cc
std::unique_ptr<DeviceWatcher> CreateWithIdleCallback (const std::string & directory_path, ExistsCallback exists_callback, IdleCallback idle_callback, async_dispatcher_t * dispatcher)
Creates a device watcher associated with the current message loop.
Asynchronously invokes |exists_callback| for all existing devices within
the specified directory as well as any subsequently added devices until
the device watcher is destroyed. Ignores the "." directory.
The |idle_callback| is invoked once immediately after all pre-existing
devices have been reported via |exists_callback| shortly after creation.
After |idle_callback| returns, any newly-arriving devices are reported via
|exists_callback|.
|directory_path| is the directory to watch (without a trailing slash).
|exists_callback| gets called with each existing or new filename, or with
an empty string after existing files if empty_after_existing is true.
|idle_callback| gets called after |exists_callback| has returned for all
pre-existing devices, and returns before |exists_callback| is called for
any subsequently-added devices.
|idle_callback| will be deleted after it is called, so captured context
is guaranteed to not be retained.
Defined at line 69 of file ../../src/lib/fsl/io/device_watcher.cc
std::unique_ptr<DeviceWatcher> CreateWithIdleCallback (fidl::ClientEnd<fuchsia_io::Directory> dir, ExistsCallback exists_callback, IdleCallback idle_callback, async_dispatcher_t * dispatcher)
Defined at line 81 of file ../../src/lib/fsl/io/device_watcher.cc