public class TransportAdapter
- Object
- TransportAdapter
ImplementsTransportListener
A
TransportListener whose methods all do nothing, so a caller
interested in two events overrides two methods.Constructors
public TransportAdapter() |
Methods
public void endpointFound(Endpoint endpoint) | A peer advertising the same service id came into view. |
public void endpointLost(Endpoint endpoint) | A discovered peer went away before any connection was made. |
public void connectionRequested(IncomingConnection request) | A peer wants to connect. |
public void connected(Endpoint endpoint) | A connection is open in both directions and payloads may be sent. |
public void connectionFailed(Endpoint endpoint, NearbyException error) | A connection attempt failed, or was rejected by the far side. |
public void disconnected(Endpoint endpoint) | An open connection closed, whether deliberately or because the peer went out of range. |
public void payloadReceived(Endpoint endpoint, Payload payload) | A complete payload arrived. |
public void payloadProgress(Endpoint endpoint, PayloadTransferUpdate update) | Progress on a payload being sent or received. |
Inherited methods
Constructor details
TransportAdapter
public TransportAdapter()Method details
endpointFound
public void endpointFound(Endpoint endpoint)A peer advertising the same service id came into view. Expect this
repeatedly for the same endpoint across discovery sessions.
Parameters
endpointEndpoint- the peer that appeared
endpointLost
public void endpointLost(Endpoint endpoint)A discovered peer went away before any connection was made.
Parameters
endpointEndpoint- the peer that disappeared
connectionRequested
public void connectionRequested(IncomingConnection request)A peer wants to connect. Call
IncomingConnection.accept() or
IncomingConnection.reject(); a request that is never answered times
out on the far side.Parameters
requestIncomingConnection- the request to answer
connected
public void connected(Endpoint endpoint)A connection is open in both directions and payloads may be sent.
Parameters
endpointEndpoint- the connected peer
connectionFailed
public void connectionFailed(Endpoint endpoint, NearbyException error)A connection attempt failed, or was rejected by the far side.
Parameters
endpointEndpoint- the peer that did not connect
errorNearbyException- why
disconnected
public void disconnected(Endpoint endpoint)An open connection closed, whether deliberately or because the peer
went out of range.
Parameters
endpointEndpoint- the peer that disconnected
payloadReceived
public void payloadReceived(Endpoint endpoint, Payload payload)A complete payload arrived.
Parameters
endpointEndpoint- who sent it
payloadPayload- what they sent
payloadProgress
public void payloadProgress(Endpoint endpoint, PayloadTransferUpdate update)Progress on a payload being sent or received.
Parameters
endpointEndpoint- the other end of the transfer
updatePayloadTransferUpdate- how far it has got