public void OnEndpointFound(EndpointDetails discoveredEndpoint) { Debug.Log("OnEndpointFound"); mNearbyStatus = "OnEndpointFound" + discoveredEndpoint.Name + " " + discoveredEndpoint.EndpointId; EndpointHolder holder = new EndpointHolder(); holder.Endpoint = discoveredEndpoint; holder.State = EndpointState.DISCOVERED; mEndpoints.Remove(discoveredEndpoint.EndpointId); mEndpoints.Add(discoveredEndpoint.EndpointId, holder); mKnownEndpoints.Add(discoveredEndpoint.EndpointId); }
public void OnEndpointLost(string lostEndpointId) { // Endpoint lost can be called when the remote calls stop advertising. This happens even // when the connection is established. mNearbyStatus = "OnEndpointLost: " + lostEndpointId; EndpointHolder ep = mEndpoints[lostEndpointId]; if (ep != null && ep.State != EndpointState.CONNECTED) { mEndpoints.Remove(lostEndpointId); mKnownEndpoints.Remove(lostEndpointId); } }
public void OnRemoteEndpointDisconnected(string remoteEndpointId) { mNearbyStatus = "OnRemoteEndpointDisconnected: " + remoteEndpointId; EndpointHolder ep = mEndpoints[remoteEndpointId]; ep.State = EndpointState.DISCONNECTED; //OnRemoteEndpointDisconnected is called when the connection is closed. // If we are the "discovery" side of the conversation, // keep the endpoint in the list, so we can re-connect. if (mKnownEndpoints.Contains(remoteEndpointId)) { mEndpoints.Remove(remoteEndpointId); } }
internal void OnConnectionRequest(ConnectionRequest request) { if (request.RemoteEndpoint.Name != null) { mNearbyStatus = "OnConnectionRequest: " + request.RemoteEndpoint.Name; } EndpointHolder holder = new EndpointHolder(); holder.Endpoint = request.RemoteEndpoint; holder.State = EndpointState.REQUESTED; mEndpoints.Remove(request.RemoteEndpoint.EndpointId); mEndpoints.Add(request.RemoteEndpoint.EndpointId, holder); if (request.Payload != null) { mMessageLog.Add(mNearbyStatus + ": " + request.Payload); } }