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。