public class TransportAdapter

  1. Object
  2. 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

endpoint Endpoint
the peer that appeared

endpointLost

public void endpointLost(Endpoint endpoint)
A discovered peer went away before any connection was made.

Parameters

endpoint Endpoint
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

request IncomingConnection
the request to answer

connected

public void connected(Endpoint endpoint)
A connection is open in both directions and payloads may be sent.

Parameters

endpoint Endpoint
the connected peer

connectionFailed

public void connectionFailed(Endpoint endpoint, NearbyException error)
A connection attempt failed, or was rejected by the far side.

Parameters

endpoint Endpoint
the peer that did not connect
error NearbyException
why

disconnected

public void disconnected(Endpoint endpoint)
An open connection closed, whether deliberately or because the peer went out of range.

Parameters

endpoint Endpoint
the peer that disconnected

payloadReceived

public void payloadReceived(Endpoint endpoint, Payload payload)
A complete payload arrived.

Parameters

endpoint Endpoint
who sent it
payload Payload
what they sent

payloadProgress

public void payloadProgress(Endpoint endpoint, PayloadTransferUpdate update)
Progress on a payload being sent or received.

Parameters

endpoint Endpoint
the other end of the transfer
update PayloadTransferUpdate
how far it has got