gpg::EndpointDiscoveryListenerHelper

#include <endpoint_discovery_listener_helper.h>

定義輔助程式,可用於向 SDK 提供 IEndpointDiscoveryListener 回呼,不必定義完整的 IEndpointDiscoveryListener 介面。

摘要

系統會叫用這個物件設定的回呼,如鄰近連線 API 中所述。如果回呼未明確設定,則不會有任何動作。

建構函式和解構函式

EndpointDiscoveryListenerHelper()
EndpointDiscoveryListenerHelper(std::shared_ptr< EndpointDiscoveryListenerHelperImpl > impl)
建構 EndpointDiscoveryListenerHelper,從 shared_ptrEndpointDiscoveryListenerHelperImpl

公開類型

OnEndpointFoundCallback typedef
std::function< void(int64_t client_id, const EndpointDetails &endpoint_details)>
在找到遠端端點時,系統會呼叫 OnEndpointFoundCallback
OnEndpointLostCallback typedef
std::function< void(int64_t client_id, const std::string &remote_endpoint_id)>
當系統不再找到遠端端點時,會呼叫 OnEndpointLostCallback

公用函式

SetOnEndpointFoundCallback(OnEndpointFoundCallback callback)
設定 OnEndpointFoundCallback。
SetOnEndpointLostCallback(OnEndpointLostCallback callback)
設定 OnEndpoint LossCallback。

公開類型

OnEndpointFoundCallback

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

在找到遠端端點時,系統會呼叫 OnEndpointFoundCallback

client_id 是找到端點的 NearbyConnections 執行個體 ID。endpoint_details 包含找到的遠端端點的詳細資料。

OnEndpointLostCallback

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

當系統不再找到遠端端點時,會呼叫 OnEndpointLostCallback

公用函式

EndpointDiscoveryListenerHelper

 EndpointDiscoveryListenerHelper()

EndpointDiscoveryListenerHelper

 EndpointDiscoveryListenerHelper(
  std::shared_ptr< EndpointDiscoveryListenerHelperImpl > impl
)

建構 EndpointDiscoveryListenerHelper,從 shared_ptrEndpointDiscoveryListenerHelperImpl

主要供 API 內部使用。

SetOnEndpointFoundCallback

EndpointDiscoveryListenerHelper & SetOnEndpointFoundCallback(
  OnEndpointFoundCallback callback
)

設定 OnEndpointFoundCallback。

SetOnEndpointLostCallback

EndpointDiscoveryListenerHelper & SetOnEndpointLostCallback(
  OnEndpointLostCallback callback
)

設定 OnEndpoint LossCallback。