public abstract class SubscriptionWatcher extends java.lang.Object implements ILifecycleListener, IBlaubotAdminMessageListener
Constructor and Description |
---|
SubscriptionWatcher(short channelId) |
Modifier and Type | Method and Description |
---|---|
boolean |
isSubscribed() |
void |
onAdminMessage(AbstractAdminMessage adminMessage)
Called when an admin message was received
|
void |
onConnected()
Triggered when the
Blaubot instance becomes part of a blaubot kingdom. |
void |
onDeviceJoined(IBlaubotDevice blaubotDevice)
Triggered when another
Blaubot instance on another IBlaubotDevice joined the network. |
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 |
onPrinceDeviceChanged(IBlaubotDevice oldPrince,
IBlaubotDevice newPrince)
Triggered when a prince nomination was completed.
|
abstract void |
onSubscribed(short channelId)
Called when the subscription was lost due to an unsubscribe or onDisconnected event
|
abstract void |
onUnsubscribed(short channelId)
Called when a subscription to the channel was made.
|
void |
registerWithBlaubot(Blaubot blaubot) |
void |
registerWithBlaubotKingdom(BlaubotKingdom blaubotKingdom) |
void |
unregisterFromBlaubot(Blaubot blaubot) |
void |
unregisterFromBlaubotKingdom(BlaubotKingdom blaubotKingdom) |
public void registerWithBlaubot(Blaubot blaubot)
public void unregisterFromBlaubot(Blaubot blaubot)
public void registerWithBlaubotKingdom(BlaubotKingdom blaubotKingdom)
public void unregisterFromBlaubotKingdom(BlaubotKingdom blaubotKingdom)
public void onAdminMessage(AbstractAdminMessage adminMessage)
IBlaubotAdminMessageListener
onAdminMessage
in interface IBlaubotAdminMessageListener
adminMessage
- the received admin messagepublic abstract void onUnsubscribed(short channelId)
channelId
- the channel idpublic abstract void onSubscribed(short channelId)
channelId
- the channel idpublic void onConnected()
ILifecycleListener
Blaubot
instance becomes part of a blaubot kingdom.onConnected
in interface ILifecycleListener
public void onDisconnected()
ILifecycleListener
Blaubot
instance is no longer part of a blaubot kingdom.onDisconnected
in interface ILifecycleListener
public void onDeviceJoined(IBlaubotDevice blaubotDevice)
ILifecycleListener
Blaubot
instance on another IBlaubotDevice
joined the network.
It is guaranteed that for one specific IBlaubotDevice
ILifecycleListener.onDeviceJoined(IBlaubotDevice)
is never called twice without a triggered ILifecycleListener.onDeviceLeft(IBlaubotDevice)
in between.onDeviceJoined
in interface ILifecycleListener
blaubotDevice
- the joined devicepublic void onDeviceLeft(IBlaubotDevice blaubotDevice)
ILifecycleListener
IBlaubotDevice
left the blaubot kingdom.onDeviceLeft
in interface ILifecycleListener
blaubotDevice
- the device that just leftpublic void onPrinceDeviceChanged(IBlaubotDevice oldPrince, IBlaubotDevice newPrince)
ILifecycleListener
onPrinceDeviceChanged
in interface ILifecycleListener
oldPrince
- the old prince (may be null, in case no prince was nominated previously)newPrince
- the new prince (may be null, in case there is no device to be prince)public void onKingDeviceChanged(IBlaubotDevice oldKing, IBlaubotDevice newKing)
ILifecycleListener
onKingDeviceChanged
in interface ILifecycleListener
oldKing
- the old kingnewKing
- the new kingpublic boolean isSubscribed()