public class ServerConnectionManager extends LifecycleListenerAdapter
Modifier and Type | Class and Description |
---|---|
class |
ServerConnectionManager.BlaubotServerRelayConnection
A relay connection is a connection that uses admin messages to transport bytes from
A to C using an intermediate participant B (mediator).
|
Constructor and Description |
---|
ServerConnectionManager(BlaubotChannelManager channelManager,
IBlaubotDevice ownDevice,
BlaubotConnectionManager mainBlaubotConnectionManager) |
Modifier and Type | Method and Description |
---|---|
java.util.List<IBlaubotConnection> |
getConnectionsToServer() |
BlaubotKingdomConnection |
getCurrentlyUsedServerConnection() |
BlaubotServerConnector |
getServerConnector() |
void |
onConnected()
Triggered when the
Blaubot instance becomes part of a blaubot kingdom. |
void |
onDeviceLeft(IBlaubotDevice blaubotDevice)
Triggered when an
IBlaubotDevice left the blaubot kingdom. |
void |
onDisconnected()
Triggered when the
Blaubot instance is no longer part of a blaubot kingdom. |
void |
onKingDeviceChanged(IBlaubotDevice oldKing,
IBlaubotDevice newKing)
Triggered when the king device was changed.
|
void |
setMaster(boolean isMaster)
Sets whether this manager operates in master mode or not
|
void |
setServerConnector(BlaubotServerConnector serverConnector)
sets the server connector
|
onDeviceJoined, onPrinceDeviceChanged
public ServerConnectionManager(BlaubotChannelManager channelManager, IBlaubotDevice ownDevice, BlaubotConnectionManager mainBlaubotConnectionManager)
channelManager
- the main blaubot channel managerownDevice
- our own devicemainBlaubotConnectionManager
- the main blaubot connection manager used by the blaubot instance itselfpublic void setServerConnector(BlaubotServerConnector serverConnector)
serverConnector
- the connectorpublic BlaubotServerConnector getServerConnector()
public void onConnected()
ILifecycleListener
Blaubot
instance becomes part of a blaubot kingdom.onConnected
in interface ILifecycleListener
onConnected
in class LifecycleListenerAdapter
public void onDisconnected()
ILifecycleListener
Blaubot
instance is no longer part of a blaubot kingdom.onDisconnected
in interface ILifecycleListener
onDisconnected
in class LifecycleListenerAdapter
public void onDeviceLeft(IBlaubotDevice blaubotDevice)
ILifecycleListener
IBlaubotDevice
left the blaubot kingdom.onDeviceLeft
in interface ILifecycleListener
onDeviceLeft
in class LifecycleListenerAdapter
blaubotDevice
- the device that just leftpublic void onKingDeviceChanged(IBlaubotDevice oldKing, IBlaubotDevice newKing)
ILifecycleListener
onKingDeviceChanged
in interface ILifecycleListener
onKingDeviceChanged
in class LifecycleListenerAdapter
oldKing
- the old kingnewKing
- the new kingpublic void setMaster(boolean isMaster)
isMaster
- true iff operating as masterpublic BlaubotKingdomConnection getCurrentlyUsedServerConnection()
public java.util.List<IBlaubotConnection> getConnectionsToServer()