public final class ChannelAccessBeaconMessage extends ChannelAccessMessage
CA_PROTO_RSRV_IS_UP
message. This message is
sent from a server to a repeater and than relayed to the clients in order to
signal that the server is alive. Clients can use this information in order to
look for channels that could not be connected yet.ChannelAccessCommand.CA_PROTO_RSRV_IS_UP
command, originalMessageHeader
Constructor and Description |
---|
ChannelAccessBeaconMessage(Inet4Address serverAddress,
int serverPort,
ChannelAccessVersion version,
int sequenceNumber)
Constructor for creating a
CA_PROTO_RSRV_IS_UP message. |
Modifier and Type | Method and Description |
---|---|
protected static ChannelAccessBeaconMessage |
deserialize(ChannelAccessMessageHeader messageHeader,
ByteSource byteSource,
Inet4Address originAddress)
Constructs a message from a header and a byte source.
|
boolean |
equals(Object obj)
Tells whether the specified object represents the same message.
|
int |
getSequenceNumber()
Returns the sequence number.
|
Inet4Address |
getServerAddress()
Returns the IP address of the server that sent the message.
|
int |
getServerPort()
Returns TCP port on which the server listens for incoming connections.
|
ChannelAccessVersion |
getVersion()
Returns the most recent Channel Access version supported by the server.
|
int |
hashCode()
Returns a hash code value for this message.
|
protected void |
serialize(ByteSink byteSink,
ChannelAccessVersion version,
int maxPayloadSize,
Charset charset)
Serializes this message to a byte sink.
|
String |
toString()
Returns a string representation of this message.
|
addByteArrayToStringBuilder, calculatePaddingSize, getCommand, getOriginalMessageHeader, hasOriginalMessageHeader, serializeHeader, verify, verifyHeader
public ChannelAccessBeaconMessage(Inet4Address serverAddress, int serverPort, ChannelAccessVersion version, int sequenceNumber)
CA_PROTO_RSRV_IS_UP
message. This
constructor should be used for messages that are sent from a server to a
repeater.serverAddress
- the IP address of the server sending this message. If this is
the wildcard address, the receiving repeater will replace it
with the address it received the message from.serverPort
- the TCP port number on which the server is listening. If this
parameter is zero, the receiving client should use the
standard TCP port number (EPICS_CA_SERVER_PORT
)
instead.version
- Channel Access version supported by the server.sequenceNumber
- sequence number. This number is incremented each time a server
sends a beacon message. However, the same message might be
sent over multiple interfaces, therefore the same beacon
number might appear twice.public Inet4Address getServerAddress()
public int getServerPort()
public ChannelAccessVersion getVersion()
public int getSequenceNumber()
protected void serialize(ByteSink byteSink, ChannelAccessVersion version, int maxPayloadSize, Charset charset)
ChannelAccessMessage
ChannelAccessMessageCodec
.serialize
in class ChannelAccessMessage
byteSink
- byte sink that is used for writing the serialized data.version
- protocol version to stay compatible with. This is the protocol
version of the peer the message is sent to.maxPayloadSize
- maximum size of the payload.charset
- encoding to use for serializing the string data (e.g. channel
names, error strings, string data-values).public boolean equals(Object obj)
ChannelAccessMessage
Tells whether the specified object represents the same message.
Two messages are considered equal if they are of the same type and have the same headers and payload. For comparing the types, the actual Java type and not just the Channel Access command is compared.
equals
in class ChannelAccessMessage
obj
- reference object with which this object is compared.true
if obj
is a message that is of the
same type and has the same headers and payload as this message.
false
if obj
is null
or of
a different type than this message or differs in the headers or
payload.public int hashCode()
ChannelAccessMessage
Returns a hash code value for this message. This method is supported for the benefit of hash tables. The hash code is calculated as a combination of the hash codes of this messages headers (including the Channel Access command) and its payload (if present).
If two messages are equal (as indicated by the return value of
ChannelAccessMessage.equals(Object)
), they also have the same hash code. However, the
fact that two messages have the same hash code does not imply that they
are equal.
hashCode
in class ChannelAccessMessage
public String toString()
ChannelAccessMessage
toString
in class ChannelAccessMessage
protected static ChannelAccessBeaconMessage deserialize(ChannelAccessMessageHeader messageHeader, ByteSource byteSource, Inet4Address originAddress)
ChannelAccessMessageCodec
.messageHeader
- CA message header.byteSource
- byte source for reading the message's payload (if any).originAddress
- the address from which the message originated. This address is
used to replace the server address in this message if the
server address is the wildcard address.headerOnly
is
false
).BufferUnderflowException
- if there is not enough data in the byte source to read the
complete message (including he payload if
headerOnly
is false
).Copyright © 2014–2016 aquenos GmbH. All rights reserved.