template <typename ServiceMember>

class SyncServiceMemberWatcher

Defined at line 138 of file ../../sdk/lib/component/incoming/cpp/service_member_watcher.h

SyncServiceMemberWatcher allows services to be waited for synchronously.

Note that the this class is templated on the service member name, not the service name.

For example:

SyncServiceMemberWatcher

<fidl

_examples_echo::Service::EchoDevice> watcher;

zx::result

<ClientEnd

<fidl

_examples_echo::DriverEcho>> result = watcher.GetNextInstance(true);

Public Members

ClientEnd default_svc_dir_
UnownedClientEnd svc_dir_
SyncDirectoryWatcher sync_dir_watcher_

Public Methods

void SyncServiceMemberWatcher<ServiceMember> (fidl::UnownedClientEnd<fuchsia_io::Directory> svc_root)

Defined at line 143 of file ../../sdk/lib/component/incoming/cpp/service_member_watcher.h

void SyncServiceMemberWatcher<ServiceMember> ()

Defined at line 145 of file ../../sdk/lib/component/incoming/cpp/service_member_watcher.h

zx::result<fidl::ClientEnd<Protocol>> GetNextInstance (bool stop_at_idle, zx::time deadline)

Sequentially query for service instances at /svc/ServiceMember::ServiceName

This call will block until a service instance is found. When an instance of the given

service is detected in the /svc/ServiceMember::ServiceName directory, this function

will return a ClientEnd to the protocol specified by ServiceMember::ProtocolType.

Subsequent calls to GetNextInstance will return other instances if they exist.

GetNextInstance will iterate through all service instances of a given type.

When all of the existing service instances have been returned,

if |stop_at_idle| is true, GetNextInstance will return a zx::error(ZX_ERR_STOP).

Otherwise, GetNextInstance will wait until |deadline| for a new instance to appear.

Defined at line 161 of file ../../sdk/lib/component/incoming/cpp/service_member_watcher.h