public class ExchangeStatesTask
extends java.lang.Object
implements java.lang.Runnable
IBlaubotConnection
to exchange the given State
with the
remote endpoint.
The remote endpoint is the BlaubotBeaconService's BeaconConnectionHandler-Runnable.
This task does the whole beacon exchange heavy lifting and can be reused in other beacon implementations.
If the exchange is successful, the IBlaubotDiscoveryEventListener
is informed about the discovered state of
the remote endpoint.
After the execution the connection is closed.Modifier and Type | Field and Description |
---|---|
protected IBlaubotConnection |
connection |
protected IBlaubotDiscoveryEventListener |
eventListener |
protected java.lang.String |
kingDeviceUniqueId |
protected java.util.List<ConnectionMetaDataDTO> |
ourAcceptorMetaDataList |
protected IBlaubotState |
ourState |
Constructor and Description |
---|
ExchangeStatesTask(IBlaubotDevice ownDevice,
IBlaubotConnection connection,
IBlaubotState ourState,
java.util.List<ConnectionMetaDataDTO> ourAcceptorMetaData,
IBlaubotBeaconStore beaconStore,
IBlaubotDiscoveryEventListener eventListener)
Creates a new ExchangeStatesTask to be used with a IBlaubotBeaconInterface implementation.
|
Modifier and Type | Method and Description |
---|---|
void |
run() |
protected volatile IBlaubotDiscoveryEventListener eventListener
protected IBlaubotState ourState
protected IBlaubotConnection connection
protected java.lang.String kingDeviceUniqueId
protected java.util.List<ConnectionMetaDataDTO> ourAcceptorMetaDataList
public ExchangeStatesTask(IBlaubotDevice ownDevice, IBlaubotConnection connection, IBlaubotState ourState, java.util.List<ConnectionMetaDataDTO> ourAcceptorMetaData, IBlaubotBeaconStore beaconStore, IBlaubotDiscoveryEventListener eventListener)
ownDevice
- our own deviceconnection
- the connection newly created connection to the remote beaconourState
- our own state that is going to be exchanged with the other side's (accepting) beaconourAcceptorMetaData
- the list of connection meta data objects gathered from OUR OWN acceptorsbeaconStore
- the beacon store to get connection meta data for other devices fromeventListener
- the event listener of our beacon, which will be called with the appropriate discovery event by this task