コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
 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);
 }
コード例 #6
0
        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);
            }
        }