gpg::EndpointDiscoveryListenerHelper

#include <endpoint_discovery_listener_helper.h>

Defines a helper which can be used to provide IEndpointDiscoveryListener callbacks to the SDK without defining the full IEndpointDiscoveryListener interface.

Summary

Callbacks configured on this object will be invoked as described in the nearby connections API. Callbacks not explicitly set will do nothing.

Constructors and Destructors

EndpointDiscoveryListenerHelper()
EndpointDiscoveryListenerHelper(std::shared_ptr< EndpointDiscoveryListenerHelperImpl > impl)
Constructs a EndpointDiscoveryListenerHelper from a shared_ptr to a EndpointDiscoveryListenerHelperImpl.

Public types

OnEndpointFoundCallback typedef
std::function< void(int64_t client_id, const EndpointDetails &endpoint_details)>
OnEndpointFoundCallback is called when a remote endpoint is found.
OnEndpointLostCallback typedef
std::function< void(int64_t client_id, const std::string &remote_endpoint_id)>
OnEndpointLostCallback is called when a remote endpoint is no longer discoverable.

Public functions

SetOnEndpointFoundCallback(OnEndpointFoundCallback callback)
Set the OnEndpointFoundCallback.
SetOnEndpointLostCallback(OnEndpointLostCallback callback)
Set the OnEndpointLostCallback.

Public types

OnEndpointFoundCallback

std::function< void(int64_t client_id, const EndpointDetails &endpoint_details)> OnEndpointFoundCallback

OnEndpointFoundCallback is called when a remote endpoint is found.

client_id is the ID of the NearbyConnections instance that discovered the endpoint. endpoint_details contains the details of the discovered remote endpoint.

OnEndpointLostCallback

std::function< void(int64_t client_id, const std::string &remote_endpoint_id)> OnEndpointLostCallback

OnEndpointLostCallback is called when a remote endpoint is no longer discoverable.

Public functions

EndpointDiscoveryListenerHelper

 EndpointDiscoveryListenerHelper()

EndpointDiscoveryListenerHelper

 EndpointDiscoveryListenerHelper(
  std::shared_ptr< EndpointDiscoveryListenerHelperImpl > impl
)

Constructs a EndpointDiscoveryListenerHelper from a shared_ptr to a EndpointDiscoveryListenerHelperImpl.

Intended for internal use by the API.

SetOnEndpointFoundCallback

EndpointDiscoveryListenerHelper & SetOnEndpointFoundCallback(
  OnEndpointFoundCallback callback
)

Set the OnEndpointFoundCallback.

SetOnEndpointLostCallback

EndpointDiscoveryListenerHelper & SetOnEndpointLostCallback(
  OnEndpointLostCallback callback
)

Set the OnEndpointLostCallback.