public class BeaconMessage
extends java.lang.Object
implements java.io.Serializable
Constructor and Description |
---|
BeaconMessage(java.lang.String ownUniqueDeviceId,
State currentState,
java.util.List<ConnectionMetaDataDTO> ownConnectionMetaDataList)
Constructor for the beacon message in cases where we have no king or we are the king
|
BeaconMessage(java.lang.String ownUniqueDeviceId,
State currentState,
java.util.List<ConnectionMetaDataDTO> ownConnectionMetaDataList,
java.lang.String kingDeviceId,
java.util.List<ConnectionMetaDataDTO> kingsConnectionMetaDataList)
Constructor for the beacon message in case we are a subordinate to a king and therefore have a connection to a king
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
static BeaconMessage |
fromBlaubotConnection(IBlaubotConnection connection)
Create the message from the stream of a blaubot connection.
|
static BeaconMessage |
fromBytes(byte[] bytes) |
State |
getCurrentState() |
java.lang.String |
getKingDeviceUniqueId()
Note: is only set if currentState is State.Prince or State.Peasant
|
java.util.List<ConnectionMetaDataDTO> |
getKingsConnectionMetaDataList()
The acceptor meta data for the device's for which we received the state
|
java.util.List<ConnectionMetaDataDTO> |
getOwnConnectionMetaDataList()
The acceptor meta data for the device for which we received the state
|
java.lang.String |
getUniqueDeviceId()
Getter for the unique device id of the sending side
|
int |
hashCode() |
static void |
main(java.lang.String[] args) |
void |
setCurrentState(State currentState) |
byte[] |
toBytes()
Get the byte representation of this message
|
java.lang.String |
toString() |
public BeaconMessage(java.lang.String ownUniqueDeviceId, State currentState, java.util.List<ConnectionMetaDataDTO> ownConnectionMetaDataList)
ownUniqueDeviceId
- the unique device id of the sending side's ownDevicecurrentState
- our device's current stateownConnectionMetaDataList
- our own connection meta data list of our acceptorspublic BeaconMessage(java.lang.String ownUniqueDeviceId, State currentState, java.util.List<ConnectionMetaDataDTO> ownConnectionMetaDataList, java.lang.String kingDeviceId, java.util.List<ConnectionMetaDataDTO> kingsConnectionMetaDataList)
ownUniqueDeviceId
- the unique device id of the sending side's ownDevicecurrentState
- our device's current stateownConnectionMetaDataList
- our own connection meta data list of our acceptorskingDeviceId
- the king's uniqueDevice idkingsConnectionMetaDataList
- the king's connection meta data list to propagate to other interested devicepublic State getCurrentState()
public void setCurrentState(State currentState)
public byte[] toBytes()
public static BeaconMessage fromBytes(byte[] bytes)
public static BeaconMessage fromBlaubotConnection(IBlaubotConnection connection)
connection
- the connection to receive the message frompublic java.lang.String getUniqueDeviceId()
public java.lang.String getKingDeviceUniqueId()
public java.util.List<ConnectionMetaDataDTO> getOwnConnectionMetaDataList()
public java.util.List<ConnectionMetaDataDTO> getKingsConnectionMetaDataList()
public static void main(java.lang.String[] args) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object