public void InitiateConnection(string endpointId, ScanEndpointInfo scanEndpointInfo, IConnectCallBack connectCallBack)
 {
     if (scanEndpointInfo.Name.Equals(scanInfo))
     {
         Debug.Log("[HMS] Nearby Client found Server and request connection. Server id:" + scanEndpointInfo.Name);
         // Initiate a connection.
         Nearby.DiscoveryEngine.RequestConnect(myNameStr, endpointId, connectCallBack);
     }
 }
Exemple #2
0
        public override void OnFound(string Endpoint, ScanEndpointInfo scanEndpointInfo)
        {
            Device device = MainActivity.FindDevice(Endpoint);

            if (device == null)
            {
                device = new Device(scanEndpointInfo.Name, Endpoint, false);
                MainActivity.AvaliableDevicesList.Add(device);
                Log.Debug(MainActivity.TAG, "OnFound : " + Endpoint);
                context.UpdateAvaliableDevices();
            }
        }
    public void InitiateConnection(string endpointId, ScanEndpointInfo scanEndpointInfo)
    {
        NearbyManagerListener callBack = new NearbyManagerListener(this);

        nearbyManager.InitiateConnection(endpointId, scanEndpointInfo, callBack);
    }
 //ScanEndpointCallback
 public void onFound(string endpointId, ScanEndpointInfo discoveryEndpointInfo)
 {
     Debug.Log("[HMS] NearbyManager OnFound");
     nearbyManagerObject.InitiateConnection(endpointId, discoveryEndpointInfo);
     nearbyManagerObject.OnFound?.Invoke(endpointId, discoveryEndpointInfo);
 }