gpg::EndpointDiscoveryListenerHelper

#include <endpoint_discovery_listener_helper.h>

กำหนดตัวช่วยที่สามารถใช้ระบุโค้ดเรียกกลับ IEndpointDiscoveryListener ให้กับ SDK โดยไม่ต้องกำหนดอินเทอร์เฟซ IEndpointDiscoveryListener แบบเต็ม

สรุป

ระบบจะเรียกใช้โค้ดเรียกกลับที่กำหนดค่าไว้ในออบเจ็กต์นี้ตามที่อธิบายไว้ใน API การเชื่อมต่อที่อยู่ใกล้เคียง ไม่ได้ตั้งค่าโค้ดเรียกกลับไว้อย่างชัดเจน

ผู้ผลิตและผู้ทำลาย

EndpointDiscoveryListenerHelper()
EndpointDiscoveryListenerHelper(std::shared_ptr< EndpointDiscoveryListenerHelperImpl > impl)
สร้าง EndpointDiscoveryListenerHelper จาก shared_ptr ไปยัง EndpointDiscoveryListenerHelperImpl

ประเภทสาธารณะ

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)
ตั้งค่า OnEndpointLostCallback

ประเภทสาธารณะ

OnEndpointFoundCallback

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

ระบบจะเรียกใช้ OnEndpointFoundCallback เมื่อพบปลายทางระยะไกล

client_id คือรหัสของอินสแตนซ์ NearbyConnections ที่ค้นพบปลายทาง 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_ptr ไปยัง EndpointDiscoveryListenerHelperImpl

มีไว้สำหรับใช้ภายในโดย API

SetOnEndpointFoundCallback

EndpointDiscoveryListenerHelper & SetOnEndpointFoundCallback(
  OnEndpointFoundCallback callback
)

ตั้งค่า OnEndpointFoundCallback

SetOnEndpointLostCallback

EndpointDiscoveryListenerHelper & SetOnEndpointLostCallback(
  OnEndpointLostCallback callback
)

ตั้งค่า OnEndpointLostCallback